<template>
  <div>
    <el-menu
      :default-active="activeIndex2"
      router
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-menu-item index="/toAlluser" @click="getAllUser()">所有人员信息</el-menu-item>
      <el-menu-item index="/toNosign" @click="getNoregister()">未登记人员信息</el-menu-item>
      <el-menu-item index="/touser" @click="goUser()" >用户管理</el-menu-item>
    </el-menu>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'studentMain',
  data () {
    return {
      activeIndex: '1',
      activeIndex2: '1'
    }
  },
  methods: {
    handleSelect (key, keyPath) {
      console.log(key, keyPath)
    },
    goUser(){
      this.axios.post('http://localhost:8181/manager/list').then(res=>{
        console.log(res.data)
        this.$router.push(
          {
            //添加需要传值到那个页面的路径
            path:'/touser',
            //携带需要传递的参数
            query:{table2:res.data}
          })
      })
    },
    getAllUser(){
      this.axios.post('http://localhost:8181/manager/list').then(res=>{
        console.log(res.data)
        this.$router.push(
          {
            //添加需要传值到那个页面的路径
            path:'/toAlluser',
            //携带需要传递的参数
            query:{table:res.data}
          })
      })
    },
    getNoregister(){
    this.axios.post('http://localhost:8181/manager/noregister').then(res=>{
      this.$router.push(
        {
          path:'/toNosign',
          query: {
            table1:res.data
          }
        }
      )
    })
    },
  }
}
</script>
